Agent adapters
An adapter is the one small module between TechTeamUp and an AI agent. Your agent needs an API that takes a run and streams its events, and the adapter uses only that normal, documented API, so nothing is installed in or patched into the agent. One adapter ships, for Hermes Agent. Adapters for other agents are welcome, and this page is the contract to write to.
Start with the six required methods. Each capability you add turns on its matching feature, and without it the app does the next best thing. The code to read first is src/agents/contract.js, the Hermes adapter in src/agents/hermes/ and the tests in test/agents-contract.test.js.
How the two sides talk
- TechTeamUp to the agent goes through the agent’s own API, via the adapter.
- The agent to TechTeamUp goes through TechTeamUp’s MCP tools (
task_create,task_updateand the rest) and the rules TechTeamUp sends with each run (theinstructionsof every run).
The Hermes adapter lives in src/agents/hermes/ and talks to Hermes Agent’s API server.
Choosing the agent
In the server’s env file, name the adapter.
AGENT=hermes # which adapter (default hermes)
Where the agent is and its key are connected in the app, at Account › Admin settings › Agents. Connect tests them live and keeps them only if the agent answers, the key is stored encrypted and never shown again, and a change is used from the next call, with no restart. An install that already had AGENT_URL and AGENT_KEY in its env file (or HERMES_API_URL and HERMES_API_KEY) has them read into the app once, on start, after which those lines can go.
On start the server logs one line naming the agent and the capabilities it offers.
agent: Hermes (hermes); on: steer, fork, rename, remove, lostRuns, restarts, subagents, sessionInfo, labels, jobs, jobControl, jobRuns
On the Hermes side, switch the API server on (API_SERVER_ENABLED=true, API_SERVER_KEY=... in its env) and add TechTeamUp’s MCP server to its config, as connect your agent shows.
The agent’s key
The agent reaches TechTeamUp with one key, the MCP key. It works for the whole account by design, because the agent works for the account. People’s access rules limit what people see in the app but do not on their own limit the agent. A run started for a member is limited by its own run key instead (scope, below). Treat the key like an admin password, and replace it in Admin settings › Agents › Issue a new key if it may have leaked. More in security.
The contract
An adapter is a plain object of async functions, with an id (lowercase, such as hermes) and a name to show people (Hermes). src/agents/contract.js holds the contract and checks every adapter against it when the server starts (defineAgent). A missing required method, or half a capability, stops the start with a message naming what is missing.
Required methods
| Method | What it does |
|---|---|
createSession(title, { id }) → session id |
One conversation per task. The app picks the id (ttu-task-<uuid>). Creating the same id twice returns it, never a second conversation, so an app restart mid-create is safe |
startRun({ input, sessionId, instructions, idempotencyKey, priority, signal, onWait, onSend, author, urgent }) → run id |
One turn of the agent in that conversation. input is the owner’s words (a string, or chat content parts with images). instructions are the rules for this run. The same idempotencyKey never starts two runs |
getRun(runId) → { status, error?, output? } |
status is queued, running, completed, failed, cancelled, interrupted or unknown (the agent lost track of it, for example in a restart). The app polls this every few seconds while a run goes |
streamRun(runId, onEvent, signal, afterSeq) |
The run’s live events, oldest first, from after afterSeq when reconnecting. Resolves when the stream ends. A stream that can’t be opened throws with status (404 means the agent no longer holds the run’s events, and the app shows the run from its stored conversation) |
stopRun(runId) |
Interrupts a run. Safe on a run that has already ended |
messages(sessionId) → messages |
The whole conversation, oldest first, including anything the agent compacted out of the model’s view |
Messages
Messages use the common chat-completions shape, one object per message.
{ role: 'user', content: 'Check the prices', timestamp: 1764672000.5 }
{ role: 'assistant', content: 'Reading the page now.', tool_calls: [{ id: 'c1', function: { name: 'browser', arguments: '{"url":"..."}' } }], timestamp: 1764672003 }
{ role: 'tool', tool_call_id: 'c1', tool_name: 'browser', content: '...result...', timestamp: 1764672009 }timestampis in seconds since 1970, and fractions are allowed.tool_calls[].function.argumentsis a JSON string. The app turns each call and its result into a step (“Read the supplier’s pricing page”) and shows the exact call and result when the step is opened.- Each message the owner sent mid-turn (see
steerRun) is ausermessage at the point the agent read it. idanddisplay_kind: 'hidden'(left out of the conversation shown) are optional.
Run events
streamRun calls onEvent with objects like these. Anything else is ignored.
event |
Fields | What the app does with it |
|---|---|---|
tool.started |
tool, preview (short text of what it was given) |
Shows the step as going |
tool.completed |
tool |
Marks it done |
message.delta |
delta |
The agent’s words as they stream |
message.interim |
text, already_streamed |
Words said between steps |
subagent.start / subagent.complete |
subagent_id, child_session_id, goal |
A helper the agent started. With the subagents capability it becomes a sub-task |
replay.truncated |
The agent kept only the newer part of the events, so the page shows the run from its stored conversation | |
run.completed / run.failed / run.cancelled / run.interrupted |
error, output, pending_steer |
The run ended. pending_steer is owner text the run could not take before it ended, and it goes in the next turn |
Every event may carry seq (an increasing number, so a reconnect passes the last one as afterSeq and repeats are dropped) and timestamp (seconds, when it happened, so a replay keeps real times).
Errors
- Unreachable (the agent is down, restarting or didn’t answer in time). Throw with
unreachable: true, orstatus502, 503 or 504, or a network error. The app waits it out and reports one outage, not one error per call. - Full (the agent is at its limit of runs at once). Throw with
status: 429. Starts wait their turn in priority order (seecreateRunGate). - Gone (the agent no longer has that conversation). Throw with
gone: true, orstatus: 404withsession_not_foundin the message. This is known and permanent, so it is never logged as a fault.
Starting runs
priorityis who the run is for.owner(the owner’s own words) andwork(a task carrying on by itself) wait for a free slot when the agent is full or unreachable, owner first.background(reviews, step labels) is refused at once withbusy: trueand tried again later.now(the owner pressed Run now) goes first of all. An agent with no limit of its own can ignore it.signalends a wait (the owner cancelled, or the app is stopping).onWait()is called once if the start has to wait, so the caller can answer “queued” straight away.urgent()turns true when the owner presses Run now on a waiting start.onSend(true)is called just before the request goes out andonSend(false)when the agent plainly didn’t take it. Until then the owner can still edit or withdraw the words.authoris who wrote the input ({ name, ... }), for agents that attribute memory by person. It is optional.scopeis given only for a member run (see people and access), as{ token, person: { id, name, role } }.tokenis a key for this run alone, bound to that person, which ends when the run ends. An adapter whose agent can give one run its own MCP credential sendstokenas that run’s bearer to/mcpinstead of the account key. Every adapter also gets it in the run’sinstructions, which tell the agent to pass it as therunargument on every TechTeamUp tool call. The Hermes adapter relies on that second form, because Hermes sets its MCP headers once in its config. An adapter must never widen a scoped run, for example by retrying it withoutscope.src/agents/shared.jshas the run queue (createRunGate), outage reporting (createOutage) and error tests (isUnreachable,isSessionGone) any adapter can use. The Hermes adapter uses them all.
Capabilities
Each capability is offered when the adapter has all of its methods, and the app turns the matching feature on. Without it the feature stays off and the app does the next best thing.
| Capability | Methods | When on | When off |
|---|---|---|---|
steer |
steerRun(runId, text) |
Send now. The owner’s words reach a running turn after its current step. Refused (409) when the run no longer takes input | Words sent while a turn runs wait for it to end, then start the next turn |
fork |
forkSession(sourceId, { id, title }) |
A routine run opened as a task carries on in a copy of the run’s own conversation | The task starts its own conversation, and what the run reported is in the task’s result |
rename |
renameSession(id, title) |
The agent’s own list of conversations shows each task’s reference and title | Conversations keep the title they were made with |
remove |
deleteSession(id) |
Throwaway conversations are deleted afterwards | They are left in place |
lostRuns |
resolveUnknownRun(runId, admissionId, generation) |
A run lost in a restart is closed, so later turns in its conversation can start | An unknown run is treated as interrupted |
restarts |
instanceId() → id or null |
Runs cut off by the agent restarting are spotted at once | Spotted when the run reports it ended, or by the hung-run check |
subagents |
children() → sessions with parent_session_id |
Helpers the agent starts show as sub-tasks with their own steps | Their work shows in the task’s own steps |
sessionInfo |
session(id) → { id, title, started_at, ended_at, last_active, ... } |
Worker and routine-run pages show when a conversation started, ended and was last active | Those pages go by the messages alone |
labels |
complete(system, user) → text |
Steps are worded in plain words by a one-off model call | Steps keep the app’s own wording, worked out from each call |
jobs |
jobs() → jobs |
Routines, the agent’s scheduled jobs, listed and tied to processes and projects | No routines |
jobControl |
pauseJob(id), resumeJob(id) |
A scheduled check watching a paused task is paused with it, and resumed when it carries on | Checks keep their own schedule |
jobRuns |
jobRuns(limit, offset) → { data, has_more }, jobOfSession(sessionId) → job id or null |
Each routine’s runs and what they reported | Routine pages show the schedule and last status only |
Each job from jobs() has id, name, enabled, state, schedule_display, next_run_at, last_run_at, last_status, last_error, timezone, repeat and paused_reason. jobRuns rows have id (the run’s session), job_id, started_at, ended_at, last_active, title and message_count, newest activity first.
recentMessages(sessionId, n) (newest first) and lastMessage(sessionId) are optional quick reads. Without them they are taken from messages().
Host extras
Some optional views come from small read-only programs you set up on the agent’s machine, each with its own key, and each stays off until you turn it on. Those programs are not in the repo. They are optional add-on bridges on the agent’s machine, each a read-only program run as an ssh forced command with its own key, and each feature stays off unless its settings are in the env file. The list of settings is in connect your agent.
Routine runs taking a run slot (and being cancelled by Hold all work) also need the agent’s scheduler to ask the app first, with POST /api/slots/routine. For Hermes that is part of the same add-on. Every ssh request word is refused before ssh runs if it holds a shell character (; | $ \ & < >`, quotes, backslash or a line break), so a bridge request never changes the remote command.
Adding an agent
- Make
src/agents/<id>/index.jsexporting a factorycreate<Name>Agent({ env, ...testOptions })that reads its own settings fromenv(AGENT_URLandAGENT_KEY, which the app fills from Admin settings › Agents) and returns the adapter object, withid,name, the six required methods and whichever capabilities the agent’s API supports. Use only the agent’s normal, documented API. – To be connected in Admin settings › Agents, also export its connection (likeHERMES_CONNECTION). That isfields(each{ name, label, secret?, required?, help? }, whereurlandkeyare what the factory reads asAGENT_URLandAGENT_KEY),env(the env names an older install kept them under),test(cfg)returning{ ok, message }from a real call with those settings, andrunCredential: trueonly when the adapter sends a member run’sscope.tokenas that run’s own bearer. List it inAGENT_CONNECTIONSinsrc/agents/index.js, and give the adapterconfigure({ url, key })so a change takes effect without a restart. - List it in
ADAPTERSinsrc/agents/index.js. - Copy the “bare agent” tests in
test/agents-contract.test.jsfor yours. It must passdefineAgent, and a task must run end to end against a stand-in of its API. - Document its settings and what it offers on this page, in the same pull request.
TechTeamUp connects to agents through their API only. It never runs an agent’s command line itself or reads its private files, so an agent that only has a command line needs an API in front of it first.
Next
Contributing covers how pull requests are reviewed.
Something unclear? Open an issue