Company Goals
Manage standing responsibilities with SQLite for development. PostgreSQL is supported for production, with the same sync and async methods.
Content
Company Goals
Manage standing responsibilities with SQLite for development. PostgreSQL is supported for production, with the same sync and async methods.
| File | What it teaches | | --- | --- | | 01_manage_goals.py | Create two owners' Goals, list unscoped or by owner, soft-delete, inspect and restore. | | [10_customer_feedback/](10_customer_feedback/README.md) | Live GPT-6.1 Sol feedback review, human acceptance, and a saved product brief through the AgentOS UI. |
Run with the development environment:
.venv/bin/python cookbook/05_agent_os/30_company/01_manage_goals.py
For HTTP access, configure AgentOS(db=db, company=CompanyConfig()) using AgentOS and CompanyConfig from agno.os. An explicit CompanyConfig(db=...) overrides the OS database. Omitting Company leaves its routes and scopes absent.
The routes are GET and POST /company/goals, GET, PATCH and DELETE /company/goals/{id}, and POST /company/goals/{id}/restore. Lists return {data, meta} with limit and page; reads accept include_deleted=true. Restore requires goals:delete, like deletion. Read and create/update require goals:read and goals:write respectively.
CompanyManager takes a sync database; AsyncCompanyManager takes an async database and exposes the same methods as coroutines. list() returns rows and a total. user_id=None is unscoped; a string filters by owner before paging. The HTTP layer records the authenticated caller as the creator. Company records are shared: reads need the read scope and writes need the write or delete scope, whoever created the Goal. User isolation does not restrict Company records.
Upgrading from agno 3.2.0
In 3.2.0 a Goal was a Product and its objective was its purpose. The new version stores Goals under new table and column names, so a 3.2.0 database must be migrated once. AgentOS does not migrate it by itself: until you do, AgentOS starts, everything outside Company works, and Company answers with MigrationRequiredError and the command to run.
- Stop every process that runs 3.2: they fail against a migrated database.
- Back up the database. The migration cannot be reversed, and
down()does not undo it. - Migrate the Company database, and the AgentOS database when they are different databases. Run it once, from one process:
import asyncio
from agno.db.migrations.manager import MigrationManager
asyncio.run(MigrationManager(db).up())
Or deploy the new version and call POST /databases/all/migrate once AgentOS is up. Company then starts without a restart.
The migration renames the stored tables and columns in place and keeps every id. It also lets goal_id be empty on the projects and tasks tables, because a Goal is optional from 3.3.0. PostgreSQL drops the requirement in place. SQLite cannot, so there each of the two tables is created again without it and its rows and indexes are carried over; a run that stops part way is finished by the next run. A deployment made from the 3.2.0 template then runs with no edit. Your own code that calls the Company Python API by its 3.2.0 names needs the rename first: see the names that changed with no alias, below.
A Routine keeps the instructions saved in it. Where they name a Company tool by its 3.2.0 name, for example read_product_source, the migration writes the current name in its place. The line they start with, Operate only on Product "<id>"., becomes Operate only on Goal "<id>".
If a 3.2 process starts after the migration, it creates its old tables again (agno_company_products and agno_company_products_details). The new version does not use them. Your Goals are not changed, but anything the 3.2 process wrote to those tables is not shown. Stop the process, copy any row you need, then drop the two tables.
These 3.2.0 names are still accepted:
| 3.2.0 | Now | | --- | --- | | from agno.company import Product | Goal | | Product(purpose=...) | Goal(objective=...) | | CompanyConfig(products=[...]) and company: products: in config.yaml | goals | | AcceptanceScope(product_ids=[...]) | goal_ids | | products_table= on SqliteDb and PostgresDb | goals_table= | | rehydrate_product and arehydrate_product | rehydrate_goal and arehydrate_goal | | The scopes products:read, products:write, products:delete | goals:read, goals:write, goals:delete |
products and goals are one permission under two names, in a token and in a stored role. If your application has a products permission of its own and also runs Company, rename yours before you upgrade. Otherwise its holders also have access to Company Goals.
These changed with no alias: the routes are /company/goals, with the fields goal_id and objective; CompanyManager takes objective= and goal_id= where it took purpose= and product_id=, and discard_product is discard_goal; the Company tools and the CompanyTools methods are named for Goals, for example create_company_goal and update_goal_status; a row holds goal_id where it held product_id, so a custom check in acceptance_checks reads task["goal_id"]; and the tree path is goals/<goal-id>/. A request that still sends product_id as a filter, or purpose in a Goal body, is answered with 422.
A Task's input changed. In 3.2.0 every executor received the Goal's brief.md and status.md and every page of the company wiki. Now every executor, Mini Agent included, starts with the Task's brief and evidence only, and the input no longer has a wiki key. What a Task needs beyond its brief is attached to the Task: a wiki page, a page of its Goal, an earlier Task or a file a Task wrote. The input carries what is attached under context. If an executor relied on a page, attach that page to the Task, or put what it needs in the brief. Mini Agent also reads any page with its file tools. See "What a Task run is given".
This holds for an input built after the upgrade. A retry that was already queued on 3.2.0 keeps the input it was queued with, and an agent or team with add_history_to_context=True reads its own earlier attempts of the same Task, so an attempt that ran on 3.2.0 can bring its pages back.
Weekly Mini Agent review
10_weekly_goal_review.py declares a Company Routine with no executor, so it runs on Mini Agent. Naming executor_type="agent", executor_id="miniagent" does the same. It reads Sources and existing work, proposes only evidence-backed Backlog Tasks, and updates status without accepting work. Mini Agent is a restricted agent for unattended work. In a Routine run it holds Company tools and the Routine skills only, no Platform Builder, no run or platform tools, and proposal-only authority. In a Task run it does the accepted work; see "Decisions from chat and Mini Agent Tasks" below. It works with or without manager=OSManager(...). Its model is CompanyConfig(model=...), else Super Agent's model when manager=OSManager(model=...) is set, else the first registry model. The stored schedule, the Routine API and the run and session records all name it: endpoint /agents/miniagent/runs, target_type agent, target_id miniagent. Mini Agent is hidden from GET /agents, GET /config, MCP and A2A, and a person cannot chat with it: it refuses every run that is not a Company Routine or a Company Task. Super Agent refuses a run with Routine authority, and a Routine that names Super Agent or any other framework ID is refused.
Check both configurations without model calls or an active scheduler:
.venv/bin/python cookbook/05_agent_os/30_company/10_weekly_goal_review.py --check
.venv/bin/python cookbook/05_agent_os/30_company/10_weekly_goal_review.py --check --with-os-manager
Start the local server with --enable-weekly-review to opt in to Monday reviews at 09:00 Europe/London. Use --source /absolute/path/to/docs.md to select a local Source, and --with-os-manager to serve Super Agent alongside it. Scheduled runs require provider credentials and incur model usage. Automatic acceptance remains off. Omitting the opt-in flag creates no new Routine; it does not remove a previously saved schedule. Pause an existing Routine through its Company API/UI control.
The example uses SQLite and no authentication for local development. For an authorized deployment, use PostgreSQL and configure the Routine through the existing authenticated Routine API, setup API or human Company chat so the caller's grant is saved. A code/YAML declaration's user_id is attribution, not a grant. An authorized execution-changing PATCH (for example, updating instructions) can authorize an existing declared Routine. A timing-only edit does not replace its authority. For direct Python bootstrap or CompanyManager.create_routine, pass the owning AgentOS as agent_os=agent_os when the Routine runs on Mini Agent.
The caller needs Routine/schedule configuration permissions and the target's agent/team run permission; scheduled result polling also needs the target's read permission. For a Routine on Mini Agent these are agents:miniagent:run and agents:miniagent:read. A grant on Super Agent is not a grant on Mini Agent. Grant only the Company tools the review uses: Sources and existing work reads, proposal writes and wiki reads/writes. Delegation retains those grants and Routine restrictions. Company-wide collaborative reads keep their existing visibility; Source contents and mutations retain Goal checks, and private sessions retain the deployment's ownership isolation.
Any caller with routines:write, schedules:write and the executor's run permission can manually trigger, edit, pause or resume a Routine, including one created by another user or seeded without an owner. Manual runs use the caller's authority and record that caller in the run's user_id. The scheduler follows the run with that authority, so the caller also needs the executor's read permission for the run to be recorded as successful. The saved Routine creator and authorization remain unchanged for scheduled runs; only edits to the executor, instructions or acceptance policy save the editor's authorization. A Routine with automatic acceptance accepts proposals with the saved grant of the user who authorized it, so only that user or an admin can trigger it manually. A policy declared in code has no author: where authorization is off, whoever may run the Routine can trigger it.
Work records
| File | Demonstrates | | --- | --- | | 02_manage_projects.py | Goal-contained Projects, owner filtering, explicit transitions, soft delete and restore. | | 03_manage_tasks.py | Backlog proposals, executor acceptance, frozen scope, rescoping, review and completion. | | 18_work_without_a_goal.py | A Task with no Goal in the Default Project, a Project with no Goal, and what the Default Project refuses. | | 20_task_handoff.py | One Task hands its work to the next: a handoff note in its folder, and the next Task created with the first attached. No model call. | | 09_sandboxed_engineers.py | Claude and Codex execute a Task from a public repository in Docker, with durable checkpoints and checkout pinning. |
A Goal is a standing aim: it has Sources, Routines, brief.md and status.md, and no end date. A Goal is optional. A Project is an outcome that finishes, and it may serve a Goal or none: goal_id is optional on POST /company/projects and on propose_company_project.
Every Task belongs to a Project. A Task created with no project_id goes into the Default Project, the one place for a single piece of work that fits no other Project, so nobody makes a Project to hold one Task.
The Goal on a Task only says which Goal the Task belongs to. A Task does not need one.
- A Task in a Project other than the Default one carries that Project's Goal, or none when the Project has none. A
goal_idleft out is filled from the Project, and a different one is refused. - A Task in the Default Project carries the
goal_idit is given, or none. This is the same throughPOST /company/tasks,propose_company_taskand the manager. - A Task and a Project that a Routine proposes carry the Routine's Goal, also when the Task names no Project and lands in the Default Project. A Routine is refused another Goal.
- A Backlog Task can move between Projects.
project_id: nullmoves it to the Default Project. A Task that has a Goal keeps it, so it moves only to a Project of the same Goal or to the Default Project. A Task with no Goal takes the Goal of the Project it moves into. GET /company/tasks?has_goal=falseandGET /company/projects?has_goal=falselist the records with no Goal;has_goal=truelists the others.
The Default Project has the fixed id default and the name "Default". It is stored when Company starts and on first use. Project responses carry is_default, true for this Project only. It has no Goal, is always active, is listed like any Project and never finishes: it is not proposed, approved, completed or cancelled, the Refresh Routine and auto-accept never complete it, auto-accept never accepts a Task in it (nobody approved it, so such a Task waits for a person), and archiving a Goal leaves it in place (the Goal's own Tasks in it are archived and restored with the Goal). Renaming, editing, a transition and archiving are each refused with the reason, by the API (422 for an edit, 409 for a transition or a delete), the tools and a Routine.
Backlog drafts can be created under a proposed Project so people can review the plan. The Project must be approved before its Tasks move to Ready or start a run; creating a Task directly in Ready also requires approval. A human transitions a proposed Project to active. Project approval does not accept or execute Tasks. The Default Project needs no approval. New Backlog proposals reuse an existing Task with the same key.
A database created before this change requires a Goal on every Project and Task. The 3.3.0 migration removes that requirement; see "Upgrading from agno 3.2.0". A Task run with no Goal starts like any other, with its brief, its evidence and what was attached to it, and writes only its own tasks/<task-id>/ folder. Its list tools still read Projects and Tasks company-wide, as they do for any Task run.
Routine instructions can make these two approval steps explicit:
Propose up to three improvements with evidence, expected impact and acceptance
criteria. Check existing work for duplicates. Create Backlog Tasks under a
suitable Project, proposing one if needed. Report that a proposed Project
needs human approval before those Tasks can be accepted or run.
Do not approve Projects, accept Tasks or execute work.
Projects start proposed and move to active, then done. A Project can be cancelled from any non-terminal state, and its terminal states cannot transition. Tasks are created in backlog by default; POST /company/tasks also accepts status set to ready (with executor_type and executor_id, under the same acceptance checks as the Ready transition) or cancelled under an approved Project. Tasks move through ready, in_progress, in_review, and done. Each transition takes target and a non-empty reason; history is returned on the record. A Task can move to Backlog, Ready or Cancelled from any other state, including done and cancelled. Backlog clears acceptance so scope can change. In progress is entered only by starting a run: direct HTTP transitions to In progress return 409 and name the runs endpoint. While a run attempt is still executing or paused awaiting approval, moves out of In progress return 409 and name that run's cancel endpoint. In review and Done follow a run; reaching them from any state other than In progress and In review respectively requires an earlier run attempt. A done or cancelled Task cannot reopen inside a done or cancelled Project.
The HTTP routes use /company/projects and /company/tasks, with the same CRUD, paging, soft delete and restore conventions as Goals, plus POST /{id}/transitions. Task Ready requests include executor_type and executor_id; the API applies the scheduler's caller run-permission check. Acceptance also validates the executor against the registry, then the published Studio components in the AgentOS catalog, like the ordinary run routes. Direct Python callers pass registry=Registry(...) to their Company manager.
Project and Task HTTP reads are company-wide for callers with the resource's read scope, matching Goals. Edits and transitions are collaborative: callers with the resource write scope can update or transition another creator's work, even with user isolation enabled. This includes cancellation and returning Tasks to Backlog. The creator stays unchanged, and transition history records the acting caller. Ready still requires the caller's executor run permission; accepted Tasks keep their brief, Project, evidence and executor until returned to Backlog, because an accepted Task runs under its accepter's permissions. The title stays editable at any stage (Company tools run by Routines and executors edit Backlog Tasks only). Delete and restore need the delete scope, not ownership. New work can use another owner's Goal or Project, with the Task and Project still required to belong to the same Goal. Manager and storage methods retain explicit owner filters for direct callers.
Playbook and Super Agent
| File | Demonstrates | | --- | --- | | 04_manage_playbook.py | Sync/async wiki pages, atomic page creation, version conflicts and the learning decision log without a model. | | 05_super_agent_company.py | Company work through Super Agent's Company tools: company details, a Goal with a Routine on Mini Agent, a proposal, status and a decision, without a model call. | | 16_company_file_tree.py | The file tree through Super Agent's tools, without a model call: a confirmed company page and Goal brief, a Goal page, a Task file, a note, and what a Task's input holds before and after a page is attached. |
Each Goal has a durable wiki folder with brief.md (human direction) and status.md (current work). A second folder holds company context. Default pages are created on first access and never reset. GET /company/goals/{id}/wiki lists pages; GET and PUT /company/goals/{id}/wiki/{path} read and write them. The company wiki has the same surface at /company/wiki. Writes require the filesystem expected_version read with the page; zero means create only. Conflicts return 409. Pages are Markdown and paths must be relative and normalized.
Wiki reads require wiki:read; writes require wiki:write. Goal and company pages are shared documents, so any caller with wiki:write can change them, and every caller with read permission can read both. Company services use FileSystem; its existing backend owns storage and version checks.
GET and POST /company/decisions use decisions:read and decisions:write. Decisions are learning log entries in the company namespace, never a file. Listings support text, agent, session and age filters plus standard paging. The server stamps human identity; agents get identity from injected run context. Super Agent holds no decision-log tools. Mini Agent holds none either and has no decision log in its prompt, in a Routine run or a Task run: it reads Sources and briefs that nobody vetted, so it neither writes Company decisions nor recalls them. The API above and CompanyTools on your own agents write and search the log. A Task run on any other executor that holds CompanyTools is refused a write to the log. An agent you give LearningMachine(decision_log=CompanyDecisionLogStore(db)) recalls human and agent decisions across the company; explicit searches can still filter by agent. The learning machine binds the agent ID when supplying decision tools. Standalone CompanyTools leave agent attribution unset. The log is append-only: later outcomes are new entries that reference the original decision.
One file tree
Super Agent and Mini Agent see the wiki, each Goal's pages, each Task's files and Super Agent's notes as one tree, addressed by path:
wiki/ agreed direction: brief.md and status.md by default
goals/<goal-id>/ brief.md and status.md by default, and what agents found
tasks/<task-id>/ what one Task was given and what it produced
notes/ Super Agent's own notes
priorities.md, people.md and how-we-work.md are the names Super Agent uses in wiki/. Each is created when there is something to put in it. A Goal is addressed by ID, and listing goals/ shows each name beside its ID. Pages in wiki/ and goals/ are Markdown; tasks/ and notes/ take any text file.
Where it is stored. Every Company file is in the Company file system: one store in the Company database, the namespace company, with each file at its path in the tree. notes/ is a folder of it. Without Company, Super Agent still has notes/: the same store in the AgentOS database holds it. The wiki API above serves the same pages.
The folder of a Goal or a Task is its ID written as one path segment. An ID made of letters, digits and . - _ @ + is its own folder name. Any other character is escaped, so Docs Team is stored under goals/Docs%20Team/ and no two IDs share a folder. The tools and the routes still name a Goal by its ID.
Upgrading from 3.2. The 3.3.0 migration above also moves the files: each one to its tree path with its content, version and timestamps. AgentOS does not move them as it starts.
- Until the migration has run, AgentOS starts and the Company file system refuses each use with an error that names what to run:
MigrationManager(db).up()orPOST /databases/all/migrate. It also stays refused when a different file is already stored at a path a file moves to. - With a separate Company database, the notes move into it from the AgentOS database.
POST /databases/all/migratedoes this once both databases are migrated. AfterMigrationManager(db).up()on each, callmove_company_notes(agent_os_db, company_db)fromagno.db.migrations.versions.v3_3_0. Until thennotes/is refused. - The migration never guesses where a file belongs. Files of a Goal or Task it cannot be sure of stay where they are and are reported in the log.
company_files_left(db)lists them, andmove_company_files(db, owners={namespace: id})moves a namespace to the owner you name. Both are inagno.db.migrations.versions.v3_3_0. - The namespace
companybelongs to the Company file system. On an AgentOS with Company, an agent whose ownFileSystemuses the shared partition of that namespace in the same database is refused when its run starts. Give that filesystem another namespace, and move its files there.
On the File System page. With Company on, the Company file system is one entry of the page: namespace company, with wiki/, goals/, tasks/ and notes/ under it. GET /filesystem/namespaces lists it. Browsing it there needs filesystem:read and the scopes the Company routes ask for: wiki:read, and tasks:read too for tasks/.
Nothing in the tree is isolated by user. notes/ is one folder shared by everyone who talks to Super Agent, including when user isolation is on. A note Super Agent saved in one person's chat can be read in another person's chat. Listing goals/ and searching the tree show every Goal, as the Goal listing does.
Reading it over the API. wiki/ and each Goal's pages have the wiki routes above. A Task's files and the notes have read routes, so the Company pages can show what Super Agent and its workers wrote:
| Route | Scope | Returns | | --- | --- | --- | | GET /company/tasks/{id}/files | tasks:read and wiki:read | The Task's files, paged with limit and page | | GET /company/tasks/{id}/files/{path} | tasks:read and wiki:read | One file: content, metadata and next_offset | | GET /company/notes | wiki:read | The notes, paged the same way | | GET /company/notes/{path} | wiki:read | One note |
A Task's files ask for wiki:read as well as tasks:read, because reading them in chat asks for wiki:read. A listing returns at most 200 files a page.
Each path is inside its folder: report.md, not tasks/<task-id>/report.md. One read returns at most 40,000 characters. A longer file returns next_offset; send it as offset to read on. A Task that is missing or archived returns 404 Task not found, as the Task route does. These two folders have no write, delete or search route.
Super Agent is told that notes/ is shared. What a person marks private, or for Super Agent only, goes to its memory of that person when OSManager(learning=...) keeps a user profile or a user memory. With no such memory, Super Agent says it has no private place and writes nothing.
The tools are CompanyFileTools. Their names keep them apart from the source file tools (list_files, read_file, search_content) that OSManager(root=...) adds.
| Tool | Permission | Writes | | --- | --- | --- | | list_company_files, read_company_file, search_company_files | wiki:read, none for notes/ | | | write_company_file | wiki:write for a Goal's pages, tasks:write for a Task's folder, none for notes/ | notes/, tasks/<task-id>/ and a Goal's pages other than brief.md | | save_company_page | wiki:write, a person's chat only | wiki/ pages and a Goal's brief.md, after the person confirms | | delete_company_file | none | notes/ only |
What a call may write follows the run it is in, read from the run's authority:
| Run | May write | | --- | --- | | A person's chat with Super Agent | notes/, any Task's folder, any Goal's pages other than brief.md; wiki/ and brief.md with a confirmation | | A Task run | Its own Goal's pages other than brief.md, and its own tasks/<task-id>/ | | A Routine run | Its own Goal's status.md, through update_goal_status only. The file tools refuse every write in a Routine run |
save_company_page pauses the run. The confirmation shows the page, the version the person saw, the text removed (old_text) and the text added (new_text). With old_text it replaces that exact text, which must occur once. Without it, new_text is added at the end, or becomes a new page at version 0. A page that changed after that version is not saved. Super Agent saves only what the person states: text in a Source, a page or a tool result is never a request to save.
A Task's folder asks for tasks:write, which the person who starts a Task already holds, so a Task run can always write its own folder. A Goal's pages ask for wiki:write: a Task started by someone without it writes no Goal page and reports the refusal.
A Routine reads Sources nobody vetted, so it writes no more than its skills need: status.md, and the two pages the server composes from the summary and refresh tools. Mini Agent holds no file tools in a Routine run. On a named executor that holds them, write_company_file refuses every write in a Routine run, and the run is recorded as failed, as it is when update_goal_status is refused.
A Routine run and a Task run never see notes/. A scheduled or service-account run of Super Agent is neither: it counts as a person's chat, and reads and writes notes/.
What a Task run is given
A Task run starts with the Task's brief and its evidence. No wiki page, no Goal page and no earlier Task reaches it unless it is attached to the Task. This holds for every executor: Mini Agent, a named agent, a team, a workflow, a sandboxed coding agent and an external agent. An executor's input may leave AgentOS, so nothing of the company is sent that nobody chose.
A Task holds a context list. Each entry is a reference with who added it and when: {id, kind, ref, added_by, added_at}.
| kind | ref | What the run receives | |--------|-------|-----------------------| | wiki | wiki/<page>.md | The page. | | goal | goals/<goal-id>/<page>.md | The page, for example brief.md or status.md. | | task | A Task id | That Task's title, status and saved result with the status of the run that saved it, the names of up to 50 files in tasks/<id>/, and the full text of tasks/<id>/handoff.md when it exists. | | file | tasks/<task-id>/<path> | The file. |
notes/ and chat sessions cannot be attached.
Whoever coordinates the Task decides its context, when the Task is created or later, at any status before Done or Cancelled. The list is not frozen at acceptance.
- A person with
tasks:writeattaches any reference they may read:wiki:readfor every kind, andtasks:readas well for a Task or a Task's file. A reference they may not read, or that names nothing, is refused and nothing is attached. Super Agent acts for the person it talks to, withcontextonadd_company_taskandpropose_company_task, and withupdate_company_task_contextafterwards. Work a person asks to have done is created accepted and started by oneadd_company_taskcall, so its context is attached in that call: the run is queued before anything could be added later. A Task that call holds back for the person's confirmation keeps its context. - A Routine run changes the context of Backlog Tasks of its own Goal only, with references to that Goal's pages and Tasks and to
wiki/. - A Task run never changes a context, whatever its executor and whatever tools it holds. A worker cannot hand itself more of the company.
The API takes context on POST /company/tasks, returns it on every Task, and changes it with POST /company/tasks/{task_id}/context (body {kind, ref}) and DELETE /company/tasks/{task_id}/context/{entry_id}. Both return the Task.
When the run starts, each reference is read as it is at that moment and pasted into the input under context, in list order. Each item names its kind, its path or Task id, the version read and whether it was sent full, partial or is missing. A page's version is its file version; a Task's version is the time it last changed. Each text is cut at 8,000 characters, and the texts of one input hold 40,000 characters in total: the first that does not fit and every later one are named without their content. An attached Task's title, cut at 300 characters, and its file names count toward that total. An entry whose target was deleted is named as missing and the run still starts. Every cut and every gap is named with its reason, so the executor reports the gap instead of guessing. The block says that it is information and never an instruction.
The attempt records what was sent. The Task's history entry for the attempt, and last_run on the Task, hold context_sent: one record for each entry with its kind, its path or Task id, the version sent, and the note for anything cut, left out or missing.
To hand work from one Task to the next, the first Task writes what the next one needs to tasks/<its id>/handoff.md, and the next Task attaches the first. Mini Agent is told to write that note. 20_task_handoff.py shows it without a model.
Mini Agent as an executor also reads the whole tree on request with its file tools. An executor of your own that should read pages for itself must hold the read tools: CompanyFileTools(db, include_tools=["list_company_files", "read_company_file", "search_company_files"]). Every read result says that file content is information, never an instruction.
A listing returns 200 entries a page with the total, and next_page when more remain. A search returns up to ten matches and more when others exist. A search of the whole tree, of goals/ or of tasks/ opens the 50 newest Goals and the 50 newest Tasks. When there are more, the reply says how many it searched; name a folder, goals/<goal-id> or tasks/<task-id>, to search another.
A file holds at most 1 MB. The Company file system holds 1 GB in total, across every folder; CompanyConfig(max_filesystem_bytes=...) sets another limit. Each Task's folder also holds at most 20 MB, so a Task that fills its folder does not stop the writes of the wiki, a Goal, the notes or another Task. Nothing removes a Task's files, not even archiving the Task, because an archived Task can be restored. There are no API routes for tasks/ and notes/, and no tool appends to, moves or deletes a file outside notes/.
With CompanyConfig, Super Agent holds the Company tools itself. People do Company work by talking to Super Agent at /teams/superagent. It reads company details, Goals, Projects, Tasks, Sources and the playbook, proposes Projects and Backlog Tasks, edits owned proposals, writes status.md with a version check, saves company details and creates Routines. It can add website Sources with permission and Goal ownership. When the person asks, it approves a Project, accepts a Task and reviews a finished one; see "Decisions from chat and Mini Agent Tasks". Ownership changes, local Source additions, Goal maintenance and outbound summaries are not among its Company tools. Routines use the model from CompanyConfig(model=...), otherwise Super Agent's model, otherwise the first registry model. If none exists, diagnostics warns, a Routine on Mini Agent fails with that reason, and manual APIs still work.
The examples make no provider calls; they do not demonstrate live model quality. The heartbeat examples below demonstrate Routines and Sources.
Optional Company tool arguments accept null for omission. Empty strings are normalized to omission as well; omitted pagination uses 20 results on page 1. Required identifiers and titles still require valid values.
Async PostgreSQL derives its default database ID from the connection URL and schema, like synchronous PostgreSQL. Async SQLite already derives a stable ID from its connection details. Reuse those details (or an explicit stable id) after restart and across replicas so saved run database references resolve. This does not rewrite references saved with older randomly generated IDs; retaining a known old ID explicitly is necessary for those references.
Execution and attention
| File | Demonstrates | | --- | --- | | 06_execute_tasks.py | Durable execution, duplicate starts, ordinary run history and attention with no model call. | | 12_task_board.py | Direct start from Backlog, last_run, allowed_transitions and a board read by status with no model call. | | 13_start_tasks_from_chat.py | Super Agent starts a human-accepted Task, answers unrelated questions while it runs, and says it finished on the next message without being asked. Add --serve to try it from the AgentOS UI on localhost:7777 with a seeded, accepted Task. Live model; PostgreSQL. | | 14_work_to_done_in_chat.py | A person takes work from a proposal to Done in a Super Agent chat: approve the Project, accept the Task on Mini Agent, start it, read the result and complete it. Each decision pauses for the person's confirmation. Mini Agent runs another agent to do the work, and the Task records it. Live model; PostgreSQL. | | 19_ask_and_start_in_one_message.py | A person asks Super Agent for work in one message. The Task is created accepted with that person recorded, and started, with no confirmation. A second message adds a Task that stays Ready. Live model; PostgreSQL. | | 15_policy_source_to_done.py | One line in a Routine declaration, auto_accept=True. The Routine reads a Source and proposes work, the automation tick approves the Routine's Project and accepts its Task, Mini Agent does the Task, and the result waits In review. Every automatic step is on the record. Live model; PostgreSQL; serves on a free local port. | | 17_continue_tasks_from_chat.py | A worker stops at a decision; what it ran is read from its run. The person's answer from chat sends the Task back after they confirm, and Super Agent starts it again on the same worker session. --serve adds the UI demo. Live model; PostgreSQL. |
06_execute_tasks.py starts an accepted workflow Task through its ordinary run route and the durable queue, waits for In review, reads paged history and checks attention. It makes no provider calls. Start PostgreSQL with ./cookbook/scripts/run_pgvector.sh, then run:
.venv/bin/python cookbook/05_agent_os/30_company/06_execute_tasks.py
COMPANY_DB=postgres .venv/bin/python cookbook/05_agent_os/30_company/06_execute_tasks.py
The default stores Company records and sessions in temporary SQLite, with a PostgreSQL queue. COMPANY_DB=postgres uses PostgreSQL for both. The example creates and removes its own database schema. COMPANY_QUEUE_DB_URL overrides the local PostgreSQL URL. SQLite follows the queue's existing development fallback; use PostgreSQL session storage for production attempt fencing.
12_task_board.py starts a Backlog Task by naming its workflow executor in the run request, repeats the start, waits for In review, and reads each board column with the status filter. It makes no provider calls. With PostgreSQL running, run:
.venv/bin/python cookbook/05_agent_os/30_company/12_task_board.py
COMPANY_DB=postgres .venv/bin/python cookbook/05_agent_os/30_company/12_task_board.py
POST /company/tasks/{id}/runs accepts an optional attempt. Without it, the request joins the reserved attempt, otherwise it starts the next one. Repeating an active attempt returns the first run. In review, a stale attempt returns 409. A full queue returns 429 without changing an accepted Task or consuming the attempt; retry the same attempt when capacity is available. The durable ticket is accepted before the Task moves to In progress, and the worker can recover that update if the submitting process stops. If acceptance changes before the Task can reserve a fresh ticket, the request returns 409 and cancels the waiting ticket; an already-claimed ticket is rejected by the worker. To request a revision from In review, POST to the runs route without attempt, or with attempt equal to the highest recorded attempt plus one. The reservation writes the In review to In progress transition and clears the previous result, retaining the same session and executor. A rejected submission leaves the result and lifecycle unchanged. A fresh Ready Task starts attempt 1. Work returned to Backlog, edited, and accepted again starts the next unused attempt from Ready, retaining its session. A Backlog Task starts only when the request names executor_type and executor_id: the route accepts it with the same checks as moving it to Ready, then starts the run. If the run does not start, the Task returns to Backlog with the refusal as the transition reason. Repeating the start joins its run while the Task is Ready or its run is unfinished; after the run ends, the repeat returns 409. A failed or cancelled run moves the Task to In review, where starting it again runs its next attempt. No revision feedback field is accepted by this request. Each Task retains one session. GET on the same route returns ordinary session runs with limit and page. GET /company/runs/{id} reads an individual run and POST /company/runs/{id}/cancel uses the executor's existing cancellation route. The Company route returns 409 when the run has already ended, and saves the run's result on a Task still In progress without it; the executor's own cancel route still answers 200 for that run.
Each Task response carries last_run (status, attempt, run id and times of its latest run) and allowed_transitions (each target, whether the move is allowed now, and why not).
Start rechecks the registry, tasks:write, wiki:read and the executor's run permission. Registry-only executors receive their ordinary routes when Company is enabled. Each executor needs a run database, and execution requires QueueConfig(durable=True). Every attempt runs
Source and license
- Source
- Agno
- Original
- agno-agi/agno/cookbook/05_agent_os/30_company
- License
- Apache-2.0