How agents think and work
Agents follow a structured approach to solve problems: When you give an agent a task, it:- Understands what you’re asking for
- Explores your codebase to gather context
- Plans how to solve the problem
- Executes the changes (writing code, running commands)
- Verifies the work (running tests, checking output)
Agent capabilities
An Ona Agent operates like a developer with full environment access:- Read and write files - View code, create new files, edit existing ones
- Execute commands - Run builds, tests, linters, deployment scripts
- Search codebases - Find functions, classes, patterns across your code
- Open pull requests - Create branches, commit changes, push to remote
- Use bash commands - Run
!git status,!npm testfor quick context - Respond to feedback - Iterate based on your guidance
Talking to your agent
Ona Agent works out of the box with zero configuration. Open your environment at app.ona.com, start a conversation in the chat panel, and give it a task. The agent works autonomously in your environment, reading code, making changes, and running commands. When it’s done, it can open a pull request for your review. As you use it more, you can teach it your codebase conventions with AGENTS.md, create reusable workflows with skills, and configure guardrails for safe execution.Practical scenario 1: Add error handling
Real development task: Your API endpoints need better error handling.The prompt
What the agent does
- Explores: Reads
backend/server.jsto understand the existing transaction endpoint and error patterns - Plans: “I’ll add validation checks at the top of the handler, before the transaction logic runs”
- Executes: Adds validation code with appropriate 400 responses
- Verifies: Tests the endpoint with
curlto confirm valid and invalid requests behave correctly
Why this works
- Specific: You named the exact file and endpoint
- Examples: You referenced an existing pattern in the same file
- Clear outcomes: You listed the specific validations to add
Practical scenario 2: Write tests
Real development task: The backend has no test coverage.The prompt
What the agent does
- Reads
backend/server.jsto understand the API routes and data flow - Checks
backend/package.jsonfor available test tooling - Writes test cases covering the specified scenarios
- Runs the tests to verify they pass
- Shows you the test results
Why this works
- Specific file and endpoints named
- Test framework specified
- Test cases enumerated
- Verification requested (run tests)
Practical scenario 3: Add a new feature
Real development task: Add a portfolio creation endpoint and UI.The prompt
What the agent does
- Reads
backend/server.jsandfrontend/src/components/TransactionForm.jsxto understand existing patterns - Adds the new API endpoint with validation
- Creates the form component matching the existing style
- Updates
App.jsxto include the new form - Tests with
curland checks the frontend renders correctly
Why this works
- Named the problem: No way to create portfolios from the UI
- Suggested structure: Listed the backend and frontend changes separately
- Referenced existing patterns: “Follow the style of TransactionForm.jsx”
- Verification: “Test with curl, then verify the form”
Using bash commands for context
Agents can run bash commands mid-conversation using the! prefix:
Example workflow
You: “Fix the failing test” Agent:!npm test (sees which test is failing)
Agent: “I see user.test.ts is failing. Let me check that file…”
Agent: (reads file, identifies issue, fixes it)
Agent: !npm test (verifies fix worked)
Bash commands speed up the agent’s exploration and verification steps.
Writing effective prompts
Pattern 1: The explorer
When you don’t know where something is:Pattern 2: The planner
For complex changes:Pattern 3: The validator
When you want to check quality:Pattern 4: The documenter
For keeping docs updated:Pattern 5: The investigator
For debugging:Best practices
Do’s
• Be specific Name files, functions, or areas of code • Reference examples “Follow the pattern in auth.ts” • Request verification “Run tests after making changes” • Ask for plans “Show me your approach before coding” • Iterate “That’s close, but use async/await instead of promises” • Use AGENTS.md It auto-loads your conventions into agent contextDon’ts
• Don’t be vague “Make the app better” is too broad • Don’t skip review Always check agent code before merging • Don’t forget tests Ask agents to run tests after changes • Don’t ignore errors If the agent makes a mistake, give clear feedbackWhen agents go off track
Sometimes agents misunderstand or take the wrong approach.How to redirect
Stop early: If you see the plan is wrong, say:Prevention: Request plans
For non-trivial tasks, ask for a plan first:Parallel workflows: Multiple agents
Each Ona Environment is isolated, so you can run multiple agents simultaneously on different tasks.Why this matters
Three tasks that take 30, 10, and 15 minutes sequentially (55 minutes total) take only ~30 minutes in parallel, since each agent works in its own environment. This applies to team workflows too: one developer builds a feature while another reviews a PR, each in their own environment. Or you spin up three environments to test frontend, backend, and integration changes independently.Try it: Run two agents in parallel
- Keep your current environment open
- Start a second environment (new tab, go to app.ona.com and create/launch another environment for your repo)
- In environment 1, give the agent a task:
- In environment 2, give a different task:
Troubleshooting
Agent seems confused- Be more specific: Name exact files or functions
- Provide context: “This is a React app using hooks, not class components”
- Reference AGENTS.md: “Follow the conventions in AGENTS.md”
- Give feedback: “That’s not right because…”
- Ask it to revert: “Undo those changes”
- Try a different prompt: “Let me rephrase…”
- Explicitly ask: “Run
npm testand show me the output” - Check if tests exist:
!ls **/*.test.* - Verify test command:
!cat package.json | grep test
- Break into smaller tasks: Instead of “refactor everything,” do “refactor auth.ts first”
- Use bash commands for quick checks:
!git diffinstead of asking agent to summarize
- If no commits yet:
!git checkout .(revert all changes) - If committed:
!git reset --hard HEAD~1(undo last commit) - Start fresh: Delete environment, create new one
What you’ve learned
You now know how to:- Direct agents effectively with specific, actionable prompts
- Work with agents on real development tasks (error handling, tests, refactoring)
- Use bash commands for quick context gathering
- Write prompts that get good results (be specific, reference patterns, request verification)
- Redirect agents when they go off track
- Run multiple agents in parallel to increase throughput
Next: Lab 4: Team Essentials